import 'dart:convert';

import 'package:psi/entity/purchass_entity.dart';
/// code : 0
/// message : "操作成功"
/// data : {"dataSource":{"records":[{}],"pageNumber":1,"pageSize":10,"totalPage":1,"totalRow":4,"startTime":null,"endTime":null,"itemType":null,"empty":false},"totalAmount":275892,"totalItemCount":3536}

PurchaseListResp pruchaseListRespFromJson(String str) => PurchaseListResp.fromJson(json.decode(str));
String pruchaseListRespToJson(PurchaseListResp data) => json.encode(data.toJson());
class PurchaseListResp {
  PurchaseListResp({
      this.code, 
      this.message, 
      this.data,});

  PurchaseListResp.fromJson(dynamic json) {
    code = json['code'];
    message = json['message'];
    data = json['data'] != null ? PurchaseListData.fromJson(json['data']) : null;
  }
  num? code;
  String? message;
  PurchaseListData? data;
PurchaseListResp copyWith({  num? code,
  String? message,
  PurchaseListData? data,
}) => PurchaseListResp(  code: code ?? this.code,
  message: message ?? this.message,
  data: data ?? this.data,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['code'] = code;
    map['message'] = message;
    if (data != null) {
      map['data'] = data?.toJson();
    }
    return map;
  }

}


/// records : [{}]
/// pageNumber : 1
/// pageSize : 10
/// totalPage : 1
/// totalRow : 4
/// startTime : null
/// endTime : null
/// itemType : null
/// empty : false

PurchaseListData dataSourceFromJson(String str) => PurchaseListData.fromJson(json.decode(str));
String dataSourceToJson(PurchaseListData data) => json.encode(data.toJson());
class PurchaseListData {
  PurchaseListData({
      this.records, 
      this.pageNumber, 
      this.pageSize, 
      this.totalPage, 
      this.totalRow, 
      this.startTime, 
      this.endTime, 
      this.itemType, 
      this.empty,});

  PurchaseListData.fromJson(dynamic json) {
    if (json['records'] != null) {
      records = [];
      json['records'].forEach((v) {
        records?.add(PurchaseEntity.fromJson(v));
      });
    }
    pageNumber = json['pageNumber'];
    pageSize = json['pageSize'];
    totalPage = json['totalPage'];
    totalRow = json['totalRow'];
    startTime = json['startTime'];
    endTime = json['endTime'];
    itemType = json['itemType'];
    empty = json['empty'];
  }
  List<PurchaseEntity>? records;
  num? pageNumber;
  num? pageSize;
  num? totalPage;
  num? totalRow;
  String? startTime;
  String? endTime;
  String? itemType;
  bool? empty;
PurchaseListData copyWith({  List<PurchaseEntity>? records,
  num? pageNumber,
  num? pageSize,
  num? totalPage,
  num? totalRow,
  dynamic startTime,
  dynamic endTime,
  dynamic itemType,
  bool? empty,
}) => PurchaseListData(  records: records ?? this.records,
  pageNumber: pageNumber ?? this.pageNumber,
  pageSize: pageSize ?? this.pageSize,
  totalPage: totalPage ?? this.totalPage,
  totalRow: totalRow ?? this.totalRow,
  startTime: startTime ?? this.startTime,
  endTime: endTime ?? this.endTime,
  itemType: itemType ?? this.itemType,
  empty: empty ?? this.empty,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    if (records != null) {
      map['records'] = records?.map((v) => v.toJson()).toList();
    }
    map['pageNumber'] = pageNumber;
    map['pageSize'] = pageSize;
    map['totalPage'] = totalPage;
    map['totalRow'] = totalRow;
    map['startTime'] = startTime;
    map['endTime'] = endTime;
    map['itemType'] = itemType;
    map['empty'] = empty;
    return map;
  }

}